package cn.iocoder.yudao.module.alipay.dal.mysql.infoorganize;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.infoorganize.InfoOrganizeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.infoorganize.vo.*;

/**
 * 机构详情 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoOrganizeMapper extends BaseMapperX<InfoOrganizeDO> {

    default PageResult<InfoOrganizeDO> selectPage(InfoOrganizePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoOrganizeDO>()
                .likeIfPresent(InfoOrganizeDO::getOrganizeName, reqVO.getOrganizeName())
                .eqIfPresent(InfoOrganizeDO::getOrganizeDescribe, reqVO.getOrganizeDescribe())
                .eqIfPresent(InfoOrganizeDO::getOrganizeLogo, reqVO.getOrganizeLogo())
                .eqIfPresent(InfoOrganizeDO::getServiceWechat, reqVO.getServiceWechat())
                .eqIfPresent(InfoOrganizeDO::getServiceTel, reqVO.getServiceTel())
                .eqIfPresent(InfoOrganizeDO::getAddress, reqVO.getAddress())
                .eqIfPresent(InfoOrganizeDO::getOfficalWeb, reqVO.getOfficalWeb())
                .betweenIfPresent(InfoOrganizeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoOrganizeDO::getId));
    }

    default List<InfoOrganizeDO> selectList(InfoOrganizeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InfoOrganizeDO>()
                .likeIfPresent(InfoOrganizeDO::getOrganizeName, reqVO.getOrganizeName())
                .eqIfPresent(InfoOrganizeDO::getOrganizeDescribe, reqVO.getOrganizeDescribe())
                .eqIfPresent(InfoOrganizeDO::getOrganizeLogo, reqVO.getOrganizeLogo())
                .eqIfPresent(InfoOrganizeDO::getServiceWechat, reqVO.getServiceWechat())
                .eqIfPresent(InfoOrganizeDO::getServiceTel, reqVO.getServiceTel())
                .eqIfPresent(InfoOrganizeDO::getAddress, reqVO.getAddress())
                .eqIfPresent(InfoOrganizeDO::getOfficalWeb, reqVO.getOfficalWeb())
                .betweenIfPresent(InfoOrganizeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoOrganizeDO::getId));
    }

    default InfoOrganizeDO getByTenantId(Long tenantId){
        return selectOne(new LambdaQueryWrapperX<InfoOrganizeDO>().eqIfPresent(InfoOrganizeDO::getTenantId,tenantId));
    };
}
